/**
 * 子字典接口
 */

import { TResponse } from '@/typings'
import { IDictChildrenType } from '@/views/sys/book/dict'
import { get, post, deletes } from '..'
import { IBaseVo } from './type'

const prefixUrl = '/sys/dict/'

/** 删除字典 */
export const deleteDict = (formId: string): Promise<TResponse<boolean>> => {
  return deletes(`${prefixUrl}del`, { formId })
}

/** 根据id获取字典 */
export const getById = (formId: string): Promise<TResponse<IBaseVo<IDictChildrenType>>> => {
  return get(`${prefixUrl}getById`, { formId })
}

/** 保存字典 */
export const saveDict = (form: IDictChildrenType): Promise<TResponse<boolean>> => {
  return post(`${prefixUrl}saveDict`, form)
}
